package com.whz.clone;

import java.util.Hashtable;

/**
 * @ClassName StackMainTest
 * @Description TODO 测试
 * @Author hong-zhi
 * @Date 2021/5/3 20:04
 * @Version 1.0
 */
public class StackMainTest {
    public static void main(String[] args) {
        Stack<String> stack = new Stack<>();
        stack.push("aaa");
        stack.push("bbb");
        stack.push("ccc");
        try {
            Stack<String> clone = stack.clone();
            clone.push("ddd");
//            System.out.println(clone);
//            System.out.println(stack);
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }

        Hashtable<String, String> hashtable = new Hashtable<>();
        hashtable.put("whz-whz", "whz-whz");
        hashtable.put("zzy-zzy", "zzy-zzy");
        hashtable.put("sxm-sxm", "sxm-sxm");
        hashtable.put("jkb-jkb", "jkb-jkb");

        Hashtable<String, String> chashtable = (Hashtable<String, String>) hashtable.clone();
        chashtable.put("syy-syy", "syy-syy");
        System.out.println(hashtable);
        System.out.println(chashtable);


    }
}
